package com.hyz.controller;

import com.hyz.pojo.ResponseResult;
import com.hyz.pojo.assetRetire.AssetRetireCheck;
import com.hyz.pojo.assetRetire.AssetRetireResponse;
import com.hyz.service.OperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("运维人员")
@RestController
@RequestMapping("/operation")
public class OperationController {
    @Autowired
    private OperationService service;

    @ApiOperation("获取资产报废申请")
    @ApiResponse(code = 200, message = "成功", response = ResponseResult.class)
    @PostMapping("/opsGetAssetRetire")
    public ResponseResult<List<AssetRetireResponse>> opsGetAssetSecondment(){
        return service.opsGetAssetRetires();
    }

    @ApiOperation("根据报废申请表id审批报废请求")
    @ApiParam("申请id和判断结果")
    @ApiResponse(code = 200, message = "成功", response = ResponseResult.class)
    @PostMapping("/updateAssetRetire")
    public ResponseResult<List<AssetRetireResponse>> opsUpdateAssetRetire(@RequestBody AssetRetireCheck retireCheck){
        return service.opsUpdateAssetRetires(retireCheck);
    }
}
